#ifndef MINIQQMUSIC_H
#define MINIQQMUSIC_H
#include<QJsonArray>
#include <QWidget>
#include"commonpage.h"
#include"btform.h"
#include"volumetool.h"
#include"musiclist.h"
#include"lrcpage.h"
#include<QMediaPlaylist>
#include<QPropertyAnimation>
#include<QSqlDatabase>
QT_BEGIN_NAMESPACE
namespace Ui { class miniqqmusic; }
QT_END_NAMESPACE

class miniqqmusic : public QWidget
{
    Q_OBJECT

public:
    miniqqmusic(QWidget *parent = nullptr);
    ~miniqqmusic();
    void InitUI();
    void Quit();
    void myPushButtonInit();
    void connectSignalandSolit();
    QJsonArray randomPixmap();
    void mediaInit();
    void playMusicByIndex(CommonPage*page,int index);
    void InitSql();

    void InitMusicList();
protected:
        void mouseMoveEvent(QMouseEvent *event);
        void mousePressEvent(QMouseEvent *event);
        void onBtFormCliced(int index);
private slots:
        void updateLikePageHandler(const QString&musicId);
        void on_volume_clicked();

        void on_addLocal_clicked();

        void on_play_clicked();

        void on_playUp_clicked();

        void on_playDown_clicked();

        void on_playMode_clicked();
        void setPlaylistModeIcon(QMediaPlaylist::PlaybackMode playMdoe);

        void playAllHandler(PageType pageType);

        void playIndexHandler(CommonPage*page,int index);

        void changeModeIcon(QMediaPlayer::State state);

        void currentIndexChanged(int index);

        void setVolume(int volume);

        void durationHandler(qint64 duration);
        void positionHandler(qint64 position);

        void positionByProcessBar(double ration);

        void setBaseImage(QMediaContent);
        void on_lrcWord_clicked();

        void on_min_clicked();

        void on_skin_clicked();

private:
    Ui::miniqqmusic *ui;
    QPoint point;
    VolumeTool*_volumeTool;
    MusicList _musicList;
    QMediaPlayer*_mediaPlayer;
    QMediaPlaylist*_playList;
    CommonPage*_currentPage;
    int _currentIndex;
    LrcPage*_lrcPage;
    QPropertyAnimation*_aniation;
    QSqlDatabase _sql;
};
#endif // MINIQQMUSIC_H
